/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       window.h
 * Author:     karooolek
 * Created on: 2009-01-06
 *
 **********************************************************************************************************************/

#ifndef WINDOW_H_
#define WINDOW_H_

#include "../common.h"
#include <GL/glut.h>

namespace mGameEngine
{
namespace System
{

// Application prototype
class Application;

/**
 * A window
 * Window with single viewport for OpenGL rendering.
 */
class Window
{
private:
    // GLUT callbacks
    friend class Application;
    static void _glutReshapeFunc(int width, int height);

    /**
     * Windows title
     */
    static String _title;

    /**
     * Windows size
     */
    static Vector2 _size;

    /**
     * Windows full-screen mode
     */
    static bool _fullScreen;

    /**
     * Windows frames counter.
     */
    static uint _frames;

public:
    /**
     * Get windows title
     * @return windows title
     */
    static const String &getTitle()
    {
        return _title;
    }

    /**
     * Set windows title
     * @param title windows title
     */
    static void setTitle(const String &title);

    /**
     * Get windows size
     * @return windows size in pixels
     */
    static const Vector2 &getSize()
    {
        return _size;
    }

    /**
     * Set windows size
     * @param size windows size in pixels
     */
    static void setSize(const Vector2 &size);

    /**
     * Get windows aspect ratio
     * @return windows width/height aspect ratio
     */
    static float getAspectRatio();

    /**
     * Check if window is in full-screen mode
     * @return true if window is in full-screen mode, false otherwise
     */
    static bool isFullScreen()
    {
        return _fullScreen;
    }

    /**
     * Set windows full-screen mode
     * @param fullScreen true if window should be full-screened, false otherwise
     */
    static void setFullScreen(bool fullScreen);

    /**
     * Toggle full-screen mode
     */
    static void toggleFullScreen()
    {
        setFullScreen(!_fullScreen);
    }

    /**
     * Get windows frame rate (FPS).
     * Value is updated once per 0.1 second.
     * @return windows frame rate (FPS).
     */
    static float getFramesPerSecond();
};

}
}

#endif // WINDOW_H_
